package com.ruoyi.info.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.info.domain.SysSignin;
import com.ruoyi.info.mapper.SysSigninMapper;
import com.ruoyi.info.service.ISysSigninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 签到记录Service业务层处理
 *
 * @author silencezheng
 * @date 2022-10-19
 */
@Service
public class SysSigninServiceImpl implements ISysSigninService
{
    @Autowired
    private SysSigninMapper sysSigninMapper;

    /**
     * 查询签到记录
     *
     * @param id 签到记录主键
     * @return 签到记录
     */
    @Override
    public SysSignin selectSysSigninById(Long id)
    {
        return sysSigninMapper.selectSysSigninById(id);
    }

    /**
     * 查询签到记录列表
     *
     * @param sysSignin 签到记录
     * @return 签到记录
     */
    @Override
    public List<SysSignin> selectSysSigninList(SysSignin sysSignin)
    {
        return sysSigninMapper.selectSysSigninList(sysSignin);
    }

    /**
     * 新增签到记录
     *
     * @param sysSignin 签到记录
     * @return 结果
     */
    @Override
    public int insertSysSignin(SysSignin sysSignin)
    {
        sysSignin.setCreateTime(DateUtils.getNowDate());
        return sysSigninMapper.insertSysSignin(sysSignin);
    }

    /**
     * 修改签到记录
     *
     * @param sysSignin 签到记录
     * @return 结果
     */
    @Override
    public int updateSysSignin(SysSignin sysSignin)
    {
        sysSignin.setUpdateTime(DateUtils.getNowDate());
        return sysSigninMapper.updateSysSignin(sysSignin);
    }

    /**
     * 批量删除签到记录
     *
     * @param ids 需要删除的签到记录主键
     * @return 结果
     */
    @Override
    public int deleteSysSigninByIds(Long[] ids)
    {
        return sysSigninMapper.deleteSysSigninByIds(ids);
    }

    /**
     * 删除签到记录信息
     *
     * @param id 签到记录主键
     * @return 结果
     */
    @Override
    public int deleteSysSigninById(Long id)
    {
        return sysSigninMapper.deleteSysSigninById(id);
    }

    @Override
    public List<Map<String, Object>> getSevenDayCount() {
        return sysSigninMapper.getSevenDayCount();
    }

    @Override
    public Map<String, Object> getCount() {
        return sysSigninMapper.getCount();
    }
}
